package com.wanmait.wanmarecruit.manageController;

import com.wanmait.wanmarecruit.service.UserService;
import com.wanmait.wanmarecruit.util.AjaxResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/manage")
public class ManageUserMessageController {

    @Resource
    private UserService userService;

    @RequestMapping("getAllUserMessage")
    public AjaxResult getAllUserMessage(Integer pageNum,String keyword)
    {
        System.out.println(keyword);
        if(pageNum==null)
        {
            pageNum = 1;
        }
        Integer pageSize = 5;
        return AjaxResult.success(userService.getAllUserMessage(pageNum,pageSize,keyword));
    }
    @RequestMapping("/getUserOtherMessage")
    public AjaxResult getUserOtherMessage(Integer userId)
    {
        return AjaxResult.success(userService.getUserMessageByUserId(userId));
    }
    //封禁用户（张佳炜）
    @RequestMapping("/updateUserEnable")
    public AjaxResult updateUserEnable(Integer userId)
    {
        userService.updateUserEnableFalseByUserId(userId);
        return AjaxResult.success("已封禁此用户！");
    }
}
